{% extends "test_semantic_ui.html" %}


{% block title %}
    测试信息平台
{% endblock %}

    <link rel="stylesheet" href="{{ url_for('static', filename='css/jquery.dataTables.min.css') }}">
{% block body %}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content <HEAD></HEAD>ader (Page header) -->
    <section class="content-header" style="background-color: #ffffff;
    border-bottom: 1px solid #e7eaec !important;">
        <div class="row">
            <div class="col-xs-8">
                <h1>测试机器汇总
                </h1>
            </div>
        </div>
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12" style="margin-top:20px;">
                <div class="box box-primary" style="padding-top: 10px;">
                    <div class="box-header with-border">
                        <h3 class="box-title">机器信息</h3>
                        <!--<div class="box-tools pull-right">-->
                            <!--<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-chevron-up"></i>-->
                            <!--</button>-->
                            <!--<div class="btn-group">-->
                                <!--<button type="button" class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown">-->
                                <!--</button>-->
                            <!--</div>-->
                            <!--<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>-->
                        <!--</div>-->
                    </div>
                    <div class="box-body">
                        <div class="table-responsive">
                            <table id="machines" class="table table-striped  table-hover">
                                <thead>
                                    <tr>
                                        <th>IP</th>
                                        <th>User/Passwd</th>
                                        <th>Info</th>
                                        <th>Operation</th>
                                    </tr>
                                </thead>
                                <tbody id="tbody">
                                    {% for machine in machines_info %}
                                    <tr>
                                      <td>{{ machine.ip }}</td>
                                      <td>{{ machine.username }}/{{machine.passwd}}</td>
                                      <td>{{ machine.cpu }}核/{{machine.memory}}G</td>
                                      <td><a href="{{ url_for('main.delete_machines', ip=machine.ip) }}" class="btn btn-danger">删除</a></td>
                                    </tr>
                                    {% else %}
                                    <tr>
                                        <td>No PC Found.</td>
                                    </tr>
                                    {% endfor %}

                                </tbody>
                            </table>
                        </div>
                        <!-- responseble -->
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- ./wrapper -->
  <footer class="main-footer">
    <div class="pull-right hidden-xs">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2014-2016 <a href="http://www.shangcdn.com/">测试组</a>.</strong> All rights
    reserved.
  </footer>


    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/jquery.dataTables.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/dataTables.bootstrap.js') }}"></script>
<script type="text/javascript">

$(function() {
    var machines_info = $('#machines').DataTable({
        "paging": true,
        "lengthChange": true,
        "searching": false,
        "ordering": true,
        "info": true,
        "autoWidth": true,
        "lengthMenu": [10, 15, 20, 25],
        "oLanguage": {
            "sLengthMenu": "每页显示 _MENU_ 条记录",
            "sZeroRecords": "抱歉， 没有找到",
            "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
            "sInfoEmpty": "没有数据",
            "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
            "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "前一页",
                    "sNext": "后一页",
                    "sLast": "尾页"
                },
            "sZeroRecords": "没有检索到数据"
            //"sProcessing": "<img src='./loading.gif' />"
        },
        columns: [{
            data: 'IP'
        }, {
            data: 'User/Passwd'
        },{
            data: 'Info'
        }, {
            data: 'Operation'
        }]
    });
    //machines_info();
});
</script>


{% endblock %}
